package com.maxatime.service.impl;

import java.util.Date;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.maxatime.dao.ExamStorage1Mapper;
import com.maxatime.pojo.entity.ExamStorage2;

import com.maxatime.service.Ssbkaoshi4;

@Service
public class SsbkaoshiImpl4 implements Ssbkaoshi4{
	
	@Autowired
	ExamStorage1Mapper examStorage1Mapper;
	
	@Override
	public int deleteByPrimaryKey(Integer pkId) {
		// TODO Auto-generated method stub
		
		return examStorage1Mapper.deleteByPrimaryKey(pkId);
	}

	@Override
	public int insert(ExamStorage2 record) {
		// TODO Auto-generated method stub
		return 0;
	}
	//新增
	@Override
	public int insertSelective(ExamStorage2 record) {
		// TODO Auto-generated method stub
		Date d = new Date();
		ExamStorage2 examStorage2 = new ExamStorage2();
		BeanUtils.copyProperties(record, examStorage2);
		examStorage2.setUpdateTime(d);
		examStorage2.setCreateTime(d);
		examStorage2.setRemark("0");
		examStorage1Mapper.insertSelective(examStorage2);
		return 0;
	}

	@Override
	public ExamStorage2 selectByPrimaryKey(Integer pkId) {
		// TODO Auto-generated method stub
		return null;
	}

	@Override
	public int updateByPrimaryKeySelective(ExamStorage2 record) {
		// TODO Auto-generated method stub
		ExamStorage2 examStorage2 = new ExamStorage2();
		BeanUtils.copyProperties(record, examStorage2);
		Date d = new Date();
		examStorage2.setUpdateTime(d);
		return examStorage1Mapper.updateByPrimaryKeySelective(examStorage2);
	}

	@Override
	public int updateByPrimaryKey(ExamStorage2 record) {
		// TODO Auto-generated method stub
		return 0;
	}
	//查询
	@Override
	public Map<String, Object> list(ExamStorage2 examStorage2) {
		// TODO Auto-generated method stub
		PageHelper.startPage(examStorage2.getPageNum(), examStorage2.getPageSize());
		List<ExamStorage2> listDemo = examStorage1Mapper.list(examStorage2);
		PageInfo<ExamStorage2> pageInfo = new PageInfo<ExamStorage2>(listDemo);
		Map<String, Object> m = new HashMap<String, Object>();
		m.put("list", listDemo);
		m.put("pageInfo", pageInfo);
		return m;
	}
	//反显
	@Override
	public ExamStorage2 findpkId(int pkId) {
		// TODO Auto-generated method stub
		return examStorage1Mapper.findpkId(pkId);
	}

}
